<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.jieSuan.jiaoKuanDan"/><spring:message code="message.button.add"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="${ctx}/lib/js/html5shiv.min.js"></script>
        <script src="${ctx}/lib/js/respond.min.js"></script>
    <![endif]-->
    <style type="text/css">
           .box-body{
           margin-top:7px;
           }   
    
    </style>
</head>
<body class="skin-blue sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1><spring:message code="message.jieSuan.jiaoKuanDan"/><spring:message code="message.button.add"/></h1>
        <ol class="breadcrumb">
        <li><a href="${ctx }/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
           <li class="active"><spring:message code="message.jieSuan.jiaoKuanDanGuanLi"/></li>
        <li class="active"><a href="#"><spring:message code="message.jieSuan.jiaoKuanDan"/><spring:message code="message.button.look"/> </a></li>
    </ol>
    </section>
    <section class="content">
       <form  class="form-horizontal" id="form" action="saveSetPostOrderByHosp.html" method="post" >
        <div class=" box box-success ">
            
            	<div class="box-body">
                    <div class="form-group form-group-xs">
                        <label for="techPos" class="col-sm-2 text-right"><span class="required">*</span><spring:message code="message.jieSuan.jiaoKuanDanMingCheng"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <div class="col-sm-3 text-left">
                            <input class="form-control" id="techPos" name="postOrderName"  placeholder="<spring:message code="message.jieSuan.jiaoKuanDanMingCheng"/>" type="text">
                        </div>
                        <label for="techPosCertNo" class="col-sm-3 text-right"><span class="required">*</span><spring:message code="message.jieSuan.jiaoKuanTime"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <div class="col-sm-3 text-left">
			              	  <input class="form-control" type="text"  name="postDatetimeStr" id="postDatetime" placeholder="yyyy-MM-dd HH:mm:ss" data-provide="datepicker" data-date-fmt="yyyy-MM-dd HH:mm:ss" />
                        </div>
                    </div> 
		                    <div class="form-group form-group-xs">
		                       <label for="postBankAcct" class="col-sm-2 text-right"><span class="required">*</span><spring:message code="message.jieSuan.jiaoKuanZhangHu"/><spring:message code="message.yanZheng.maoHao"/></label>
			                        <div class="col-sm-3 text-left">
			                         <select class="form-control"  id="postBankAcct"  name="postBankAcct" >
			                                   <option  value=""><spring:message code="message.select.option"/></option>
					                       <c:forEach items="${setBankAcctInfo}" var="sba">
				            				   <option  value="${sba.bankAcctNo}">${sba.bankAcctNo}</option>
				            			    </c:forEach>
				                     </select>
			                        </div>
		                        <label for="industry" class="col-sm-3 text-right"><span class="required">*</span><spring:message code="message.jieSuan.jiaoKuanJinE"/><spring:message code="message.yanZheng.maoHao"/></label>
		                        <div class="col-sm-3 text-left">
		                             <input class="form-control" id="postAmount" name="postAmountStr" value="" placeholder="<spring:message code="message.jieSuan.jiaoKuanJinE"/>" type="text">
		                        </div>
		                    </div>
		                    
		                   <div class="form-group form-group-xs">
			                      <label for="position" class="col-sm-2 text-right"><spring:message code="message.jieSuan.jiaoKuanYinHang"/><spring:message code="message.yanZheng.maoHao"/></label>
			                        <div class="col-sm-3 text-left">
			                            <input class="form-control" id="depositBankName" name="postBankName" value="" readonly="readonly" type="text">
			                        </div>
			                        <label for="postBankAcctHolder" class="col-sm-3 text-right"><spring:message code="message.jieSuan.jiaoKuanZhangHuMing"/><spring:message code="message.yanZheng.maoHao"/></label>
			                        <div class="col-sm-3 text-left">
			                            <input class="form-control" id="acctHolder" name="postBankAcctHolder" value="" readonly="readonly" type="text">
			                        </div>
		                    </div> 
                    
                         <div class="form-group form-group-xs">
                          <label for="recpOrgId" class="col-sm-2 text-right"><spring:message code="message.jieSuan.shouKuanJiGou"/><spring:message code="message.yanZheng.maoHao"/></label>
	                        <div class="col-sm-3 text-left">
		                    <select class="form-control"  name=recpOrgId >
	                 		   <option  value="${fatherOrg.fatherOrgId}">${fatherOrg.fatherOrgName}</option>
	                 		</select>
	                      </div>
                      </div>
                   
                 
                    <div class="form-group form-group-xs">
                        <label for="remark" class="col-sm-2 control-label"><spring:message code="message.jieSuan.jiaoKuanBeiZhu"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <div class="col-sm-9">
                            <textarea class="form-control" id="postRemark" name="postRemark" rows="3" placeholder="<spring:message code="message.jieSuan.jiaoKuanBeiZhu"/>"></textarea>
                        </div>
                    </div>
                </div>
                <div class="box-footer text-center">
                    <button type="button" class="btn btn-success btn-sm" ><spring:message code="message.button.submitSpacing"/></button>
                    <a href="toPostOrderByHosp.html" class="btn btn-danger btn-sm"><spring:message code="message.button.getBackSpacing"/></a>
                </div>
            
        </div>
      </form>  
    </section>
	<%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
    $(function(){
    	
    	 $('#postBankAcct').change(function(){
    		 var postBankAcct = $(this).children('option:selected').val();
    		   $.post("getBankAcct.html",{postBankAcct:postBankAcct},function(data){
    			   $('#acctHolder').val(data.acctHolder);
    			   $('#depositBankName').val(data.depositBankName);
    		   },'json');
    		 }) 
    		 
    	
    	$('.btn-success').click(function(){
    		 if (!validate()) {return;} 
			 $.HN.message.confirm('<spring:message code="message.jieSuan.queDingTiJiaoMa"/>', '', '').on(function (e) {
                 if (e) {
                	 $('#form').ajaxSubmit({
                		dataType:"json",
             			success: function (result) {
                 			if (result.success) {
             					$.HN.message.alert("<spring:message code="message.jieSuan.tiJiaoChengGong"/>", "<spring:message code="message.HN.alert.type"/>", "success", function() {
             						window.location.href = "${ctx}/postOrder/toPostOrderByHosp.html";
             					});
             				} else {
             					$.HN.message.alert(result.msg || "<spring:message code="message.jieSuan.tiJiaoShiBai"/>", "<spring:message code="message.HN.alert.type"/>", "error");
             				}
                 		}
                 	});
                 }
    	     });
        });
    	
       	function validate() {
       		var techPos = $.trim($("#techPos").val());
    		if (techPos == null || techPos == "") {
    			$.HN.message.alert("<spring:message code="message.yanZheng.qingShuRu"/><spring:message code="message.jieSuan.jiaoKuanDanMingCheng"/><spring:message code="message.yanZheng.ganTanHao"/>", "<spring:message code="message.HN.alert.type"/>", "warn");
    			return false;
    		}
       		
       		var postDatetime = $.trim($("#postDatetime").val());
    		if (postDatetime == null || postDatetime == "") {
    			$.HN.message.alert("<spring:message code="message.yanZheng.qingShuRu"/><spring:message code="message.jieSuan.jiaoKuanTime"/><spring:message code="message.yanZheng.ganTanHao"/>", "<spring:message code="message.HN.alert.type"/>", "warn");
    			return false;
    		}
    		
       		var postBankAcct = $.trim($("#postBankAcct").val());
    		if (postBankAcct == null || postBankAcct == "") {
    			$.HN.message.alert("<spring:message code="message.select.option"/><spring:message code="message.jieSuan.jiaoKuanZhangHu"/><spring:message code="message.yanZheng.ganTanHao"/>", "<spring:message code="message.HN.alert.type"/>", "warn");
    			return false;
    		}
       		
    		var postAmount = $.trim($("#postAmount").val());
    		if (postAmount == null || postAmount == "") {
    			$.HN.message.alert("<spring:message code="message.yanZheng.qingShuRu"/><spring:message code="message.jieSuan.jiaoKuanJinE"/><spring:message code="message.yanZheng.ganTanHao"/>", "<spring:message code="message.HN.alert.type"/>", "warn");
    			return false;
    		}
    		
    		
    		if(!/^\d+(\.\d{2})?$/.test(postAmount)){
    			$.HN.message.alert("<spring:message code="message.jieSuan.jiaoKuanJinE"/><spring:message code="message.lable.daYuLingDeShu"/><spring:message code="message.yanZheng.ganTanHao"/>", "<spring:message code="message.HN.alert.type"/>", "warn");
    			return false;
    		}
    		
    		if(postAmount.length>18){
    			$.HN.message.alert("<spring:message code="message.jieSuan.jiaoKuanJinE"/><spring:message code="message.info.zuiDaChangDu"/>18<spring:message code="message.info.geZiFu"/><spring:message code="message.yanZheng.ganTanHao"/>", "<spring:message code="message.HN.alert.type"/>", "warn");
    			return false;
    		}
    		
    	
    		return true;
    	}
    })
 </script>
</body>
</html>